



#include <stdio.h>
#include <stdlib.h>


typedef struct {
  double *eles;
  size_t len;
} vector;

typedef struct {
  vector *rows;
  size_t height;
  size_t width;
} matrix;

typedef struct {
  matrix *coeff;
  vector *input;
  int in, out;
} equation;

vector* mkVector(int len);
void freeVector(vector *v);

matrix* mkMatrix(int h, int w);
void freeMatrix(matrix *m);

equation* mkEquation(int in, int out, matrix *pnts);

vector* setVElement(vector *v, int e, double val);
matrix* setMElement(matrix *m, int r, int c, double val);
double getMElement(matrix *m, int r, int c);
double getVElement(vector *v, int e);


matrix* transpose(matrix *m);
